<template>
  <f7-page>
    <f7-navbar :title="$t('m.mcty1')" back-link=" "></f7-navbar>
    <div class="content-padding">
      <div class="top-card">
        <div>
<!--          <p>{{$t('m.mcty2')}}</p>-->
          <img src="../static/logo2.png" alt="">
          <h1>{{infoData.zong || '0.00'}}</h1>
          <p>{{infoData.zong || '0.00'}} USDT ≈ {{getZol}} ZOL</p>
        </div>
        <div>
          <!--<div>
            <p>ZOL总量</p>
            <p>12000.0000</p>
          </div>
          <div>
            <p>ZOL2总量</p>
            <p>0.0000</p>
          </div>-->
        </div>
      </div>

      <div class="title-box">
        <!--有效用户
        <p><span>{{infoData.p_num}}{{$t('m.person')}}</span> 社区总数</p>-->
        <div>
          我的邀请： {{infoData.invit_num}}人
        </div>
        <div>
          有效用户：{{infoData.p_num}}人
        </div>
        <div>
          社区总数：{{infoData.team_num}}人
        </div>
      </div>
      <ul class="list-ul">
        <li v-for="(item, index) in infoData.user" :key="index">
          <div>
            <div>
<!--              <img src="../static/avatar.jpg" alt="">-->
              <p class="user-box">
                <img src="../static/user_avatar.png" alt="">
<!--                <span>{{item.username[0]}}</span>-->
              </p>
              <div><f7-icon f7="star_fill"></f7-icon>{{userLevel(item.level, item.status)}}</div>
            </div>

            <div>
              <h4>{{item.username | phoneFilter}}</h4>
              <p>ID: {{item.uid}}</p>
            </div>
          </div>

          <div>
            <p>{{$t('m.mcty5')}}</p>
            <span>{{item.down.p_yeji || '0.00'}}</span> USDT<br>
            <span>{{(item.down.p_yeji / $store.getters.config.zol_price.price).toFixed(8) || '0.00'}}</span> ZOL<br>
            <p>分享粉丝 {{item.down.team_num || 0}}</p>
          </div>
        </li>
      </ul>
    </div>
  </f7-page>
</template>

<script>
  import { getMyCommunity } from "../api/my";

  export default {
    name: "my-community",
    data() {
      return {
        infoData: {
          user: {}
        }
      }
    },
    computed: {
      userLevel() {
        return function (level, status) {
          if (status==0 && level==0) return '普通用户';
          else if(status==1 && level==0) return '有效用户';
          else return this.$store.getters.config.user_level_type[level]
        }
      },
      getZol() {
        return (this.infoData.zong / this.$store.getters.config.zol_price.price).toFixed(8);
      }
    },
    mounted() {
      this.init();
    },
    methods: {
      init() {
        getMyCommunity().then(res => {
          this.infoData = res;
        })
      }
    }
  }
</script>

<style scoped lang="scss">
  .content-padding {
    margin-top: $padding20;
  }
  .top-card {
    background-color: #fff;
    text-align: center;
    padding: 40px 0;
    img {
      width: 150px;
    }
    > div {
      &:first-child {
        h1 {
          font-size: 60px;
          font-weight: 400;
          color: $mainColor;
          padding: 20px 0 60px;
        }
      }
      &:last-child {
        display: flex;
        justify-content: space-around;
        p:last-child {
          color: $mainColor;
          padding-top: $padding20;
        }
      }
    }
  }
  .title-box {
    display: flex;
    justify-content: space-between;
    padding: $padding 0;
    span {
      color: $mainColor;
    }
  }
  .list-ul {
    li {
      display: flex;
      justify-content: space-between;
      align-items: center;
      background-color: #fff;
      padding: $padding;
      margin-bottom: $padding20;
      img {
        width: 60px;
        border-radius: 50%;
      }
      > div:first-child {
        display: flex;
        align-items: center;
        > div:first-child {
          text-align: center;
          width: 150px;
          margin-right: $padding20;
          > div{
            background: linear-gradient(to right, #b9a47d, #e0d5bf);
            text-align: center;
            border-radius: 5px;
            padding: 5px 0;
            color: #fff;
            font-size: 20px;
            .icon {
              margin-right: 5px;
              font-size: 20px;
              margin-top: -10px;
            }
            margin-bottom: 10px;
          }
        }
        h4 {
          font-size: 30px;
        }
        p {
          color: $colorGrey;
        }
      }
      > div:last-child {
        text-align: right;
        font-size: 25px;
        line-height: 40px;
        p {
          color: $colorGrey;
        }
        span {
          color: $mainColor;
        }
      }
    }
  }
  .user-box {
    margin-bottom: 10px;
    span {
      display: inline-block;
      width: 60px;
      height: 60px;
      background: $colorGrey;
      color: white;
      text-align: center;
      line-height: 60px;
      border-radius: 50%;
      margin-right: 10px;
    }
  }
</style>
